<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html class="zh-cn zh cn" lang="zh-cn"> 
<head>
    <%@ include file="../head.jsp" %>
    <link rel="stylesheet" type="text/css" href="/resource/css/validationEngine.jquery.css" />
    <link rel="stylesheet" type="text/css" href="/resource/css/template.css" />
    <script src="/resource/js/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8"></script>
    <script src="/resource/js/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
</head>

<body class="vday home">
	<div id="page"> 
	<%@ include file="../global_navi.jsp" %>
	<%@ include file="../aos_header.jsp" %><!-- 如果需要查询，要自定义aos_header --> 
  	<%@ include file="../guide.jsp" %><!-- 动态向导栏，需要后台 -->
		<div id="primary">
			<div id="primary_main" role="main">
				<div class="box product-shelf">
					<div class="box-content clearfix">
						<form id="addSettingForm" method="POST" action="addSetting" onsubmit="validateSettingForm();">
							<TABLE BORDER=0 WIDTH=401 CELLPADDING=0 CELLSPACING=0>
								<TR VALIGN=TOP>
									<TD WIDTH=401 COLSPAN=3>
										<img src="/resource/style/xpdd/act/image/step_title.gif"
											height="35" width="463" alt="步骤" />
									</TD>
								</TR>
								<TR VALIGN=TOP>
									<TD WIDTH=80></TD>
									<TD WIDTH=450 VALIGN=top>
										<img src="/resource/style/xpdd/act/image/step_2.gif"
											height="60" width="440" alt="维护参数设置" />
									</TD>
									<TD WIDTH=145 VALIGN=BOTTOM ALIGN=CENTER></TD>
								</TR>
							</TABLE>
							<br />
						
							<table>
								<tbody>
									<tr>
										<td width="100px;"></td>
										<th><span>名称：</span></th>
										<td><input maxlength="20" type="text" name="setName" id="setName" size="37" class="validate[required,funcCall[checkSp]]"/></td>
									</tr>
									<tr><td colspan="3">&nbsp;</td></tr>
									<tr>
										<td></td>
										<th><span><font color="red">价格底线：</font></span></th>
										<td><input type="text" name="setPrice" id="setPrice" size="35" class="validate[required, custom[integer],max[100],min[0]]" maxlength="3"/>%</td>
									</tr>
									<tr><td colspan="3">&nbsp;</td></tr>
									<tr>
										<td></td>
										<th><span>最大次数：</span></th>
										<td><input maxlength="3" type="text" name="maxCount" id="maxCount" size="37" class="validate[required,custom[integer],min[0]]"/></td>
									</tr>
									<tr><td colspan="3">&nbsp;</td></tr>
									<tr>
										<td></td>
										<th><span>智能强度：</span></th>
										<td><input id="amount" class="validate[required,min[1],max[10]]" type="text" name="amount" readonly="readonly" value="1" size="37"/></td>
									</tr>
									<tr><td colspan="3">&nbsp;</td></tr>
									<tr>
										<td></td>
										<td colspan="3"><div id="slider-range-max"></div><td>
									</tr>
									<tr><td colspan="3">&nbsp;</td></tr>
									<tr>
										<td>&nbsp;</td>
										<td>个性对话：</td>
										<td>&nbsp;</td>
									</tr>
									<tr><td colspan="3">&nbsp;</td></tr>
									<tr>
										<td></td>
										<th  style="vertical-align: top;"><span>低于底线：</span></th>
										<td>
											<!-- <input maxlength="256" type="text" name="firstDialog" size="20" value="这样下去老板娘要跑了"/> -->
											<textarea rows="3" cols="45" name="firstDialog" id="firstDialog" class="validate[required]" maxlength="256">这样下去老板娘要跑了</textarea>
										</td>
									</tr>
									<tr><td colspan="3">&nbsp;</td></tr>
									<tr>
										<td></td>
										<th  style="vertical-align: top;"><span>高于原价：</span></th>
										<td>
											<!-- <input maxlength="256" type="text" name="secondDialog" size="20" value="想做善事，留给其他人吧"/> -->
											<textarea rows="3" cols="45" name="secondDialog" id="secondDialog" class="validate[required]" maxlength="256">想做善事，留给其他人吧</textarea>
										</td>
									</tr>
									<tr><td colspan="3">&nbsp;</td></tr>
									<tr>
										<td></td>
										<th style="vertical-align: top;"><span>接受砍价：</span></th>
										<td>
											<!-- <input maxlength="256" type="text" name="thirdDialog" size="20" value="我就狠一狠心" /> -->
											<textarea rows="3" cols="45" name="thirdDialog" id="thirdDialog" class="validate[required]" maxlength="256">我就狠一狠心</textarea>
										</td>
									</tr>
									<tr><td colspan="3">&nbsp;</td></tr>
									<tr>
										<td></td>
										<th  style="vertical-align: top;"><span>不接受砍价：</span></th>
										<td>
											<textarea rows="3" cols="45" name="forthDialog" id="forthDialog" class="validate[required]" maxlength="256">可是我们也得生存呀!</textarea>
											<!--<input maxlength="256" type="text" name="forthDialog" size="20" value="可是我们也得生存呀" class="validate[required, maxSize[256]]"/> -->
										</td>
									</tr>
									<tr><td colspan="3">&nbsp;</td></tr>
								</tbody>
							</table>
							<div style="padding-left:55%;padding-bottom: 15px;">
								<input type="reset"" id="resetButton" value="重置"/>
								<input type="submit" id="subButton" value="提交"/>
							</div>
						</form>
					</div>
					<div class="top-corners"></div>
					<div class="bottom-corners"></div>
				</div>
				<ul class="home-page-banners clearfix"></ul>
			</div>
			<div id="secondary" class="rail">
				<div role="navigation" aria-label="New Items" class="box navigation-list new-to-store">
					<div class="title-bar">
						<h2>操作</h2>
					</div>
					<div class="box-content clearfix">
						<div class="list_content">
							<ul>
								<li><a href="/setting/list" onclick="singleLoading();">返回模板首页</a></li>
							</ul>
						</div>
					</div>
					<div class="bottom-corners"></div>
				</div>
				<div class="box navigation-list top-sellers"></div>
				<div class="module footerblock"></div>
			</div>
		</div>
	<%@ include file="../left_navi.jsp" %>
	<%@ include file="../footer.jsp" %>
	</div>
<div id="dialog-message" title="提示">
	<p>模板最多8个!</p>
</div>
<script>
jQuery(document).ready(function(){
	//设置当前路径
	jQuery("#breadcrumb").append('<li><span>:&nbsp;&nbsp;模板创建</span></li>');

	//jQuery( "#dialog:ui-dialog" ).dialog("destroy");
	jQuery("#dialog-message").dialog({
		autoOpen : false,
		modal: true,
		closeOnEscape: false,
		draggable: false,
		beforeClose: function(event, ui) {
			singleLoading();
			//跳转到主页面
			window.location.href="/setting/list";
		},
		buttons: {
			Ok: function() {
				$(this).dialog("close");
			}
		}
	});
	var size = ${enable};
	if (!size)
	{
		jQuery( "#dialog-message" ).dialog("open");
	}
	jQuery("#slider-range-max").slider({
		range: "max",
		min: 1,
		max: 10,
		value: 1,
		slide: function(event, ui) {
			jQuery("#amount").val(ui.value);
		}
	});
	jQuery("#amount").val(jQuery("#slider-range-max").slider("value"));
	
	jQuery("#addSettingForm").validationEngine();
});
function validateSettingForm()
{
	if(!jQuery("#addSettingForm").validationEngine('validate'))
    {
		return false;
    }
    jQuery("#nyroDiv a").nmCall();
}
function singleLoading(){
    jQuery("#nyroDiv a").nmCall();
}
function checkSp(field, rules, i, options)
{
	var invalidChar=/^[\|"'<>&\^\?\*~\{\}\[\]\+\-\$()#!！@？“‘%（）……￥`·_\-—=【】\\;；’”，《》,.。、:：\/]+$/;
	if (invalidChar.test(field.val())) 
	{
        return "* 不能输入特殊字符,只能包括字母、数字或者汉字";
    }
}
</script>
</body>
</html>